package scsc.web.oa.calendar.data;

import java.io.Serializable;

import scsc.pub.data.Calendar;
import scsc.pub.tools.DateUtil;
import scsc.pub.tools.StringUtil;

public class CalendarData extends Calendar implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private String workTypeName;

	private String beginTimeDB;

	private String beginHour;

	private String beginMinute;

	private String endTimeDB;

	private String endHour;

	private String endMinute;

	private String remind;

	public String getRemind() {
		return remind;
	}

	public void setRemind(String remind) {
		this.remind = remind;
	}

	public CalendarData() {
		init();
	}

	public CalendarData(Integer workId, String createDate, String beginTime,
			String beginHour, String beginMinute, String endTime,
			String endHour, String endMinute, String workType,
			String workTypeName, String workContent, String userId,
			String latestDate, String remark, Long timerId) {
		this.setWorkId(workId);
		this.setCreateDate(StringUtil.trim(createDate));
		this.setBeginTimeDB(StringUtil.trim(beginTime));
		if (beginHour.length() == 1) {
			this.setBeginHour("0" + StringUtil.trim(beginHour));
		} else {
			this.setBeginHour(StringUtil.trim(beginHour));
		}
		if (beginMinute.length() == 1) {
			this.setBeginMinute("0" + StringUtil.trim(beginMinute));
		} else {
			this.setBeginMinute(StringUtil.trim(beginMinute));
		}
		this.setBeginTime(this.getBeginHour() + ":" + this.getBeginMinute());
		this.setEndTimeDB(StringUtil.trim(endTime));
		if (endHour.length() == 1) {
			this.setEndHour("0" + StringUtil.trim(endHour));
		} else {
			this.setEndHour(StringUtil.trim(endHour));
		}
		if (endMinute.length() == 1) {
			this.setEndMinute("0" + StringUtil.trim(endMinute));
		} else {
			this.setEndMinute(StringUtil.trim(endMinute));
		}
		this.setEndTime(this.getEndHour() + ":" + this.getEndMinute());
		this.setWorkType(StringUtil.trim(workType));
		this.setWorkTypeName(StringUtil.trim(workTypeName));
		this.setWorkContent(StringUtil.trim(workContent));
		this.setUserId(StringUtil.trim(userId));
		this.setLatestDate(StringUtil.trim(latestDate));
		this.setRemark(StringUtil.trim(remark));
		this.setTimerId(timerId);
		if (timerId != null)
			this.setRemind("1");
		else
			this.setRemind("0");
	}

	public void reset() {
		init();
	}

	public void init() {
		this.setCreateDate("");
		this.setBeginTime("");
		this.setBeginHour(DateUtil.getTimeStamp().substring(11, 13));
		this.setBeginMinute(DateUtil.getTimeStamp().substring(14, 16));
		this.setEndHour(DateUtil.getTimeStamp().substring(11, 13));
		this.setEndMinute(DateUtil.getTimeStamp().substring(14, 16));
		this.setEndTime("");
		this.setWorkType("");
		this.setWorkTypeName("");
		this.setWorkContent("");
		this.setUserId("");
		this.setLatestDate("");
		this.setRemark("");
		this.setTimerId(null);
	}

	public String getWorkTypeName() {
		return workTypeName;
	}

	public void setWorkTypeName(String workTypeName) {
		this.workTypeName = workTypeName;
	}

	public String getBeginHour() {
		return beginHour;
	}

	public void setBeginHour(String beginHour) {
		this.beginHour = beginHour;
	}

	public String getBeginMinute() {

		return beginMinute;
	}

	public void setBeginMinute(String beginMinute) {
		this.beginMinute = beginMinute;
	}

	public String getEndHour() {
		return endHour;
	}

	public void setEndHour(String endHour) {
		this.endHour = endHour;
	}

	public String getEndMinute() {
		return endMinute;
	}

	public void setEndMinute(String endMinute) {
		this.endMinute = endMinute;
	}

	public String getBeginTimeDB() {
		return beginTimeDB;
	}

	public void setBeginTimeDB(String beginTimeDB) {
		this.beginTimeDB = beginTimeDB;
	}

	public String getEndTimeDB() {
		return endTimeDB;
	}

	public void setEndTimeDB(String endTimeDB) {
		this.endTimeDB = endTimeDB;
	}
}
